import styles from './index.css';
import Link from "umi/link"
import {connect} from "dva"
import { Layout, Menu, Breadcrumb, Icon ,Input, Dropdown, message,Tabs} from 'antd';
const { SubMenu } = Menu;
const { Search } = Input;
const { TabPane } = Tabs;
const { Header, Content, Sider } = Layout;


const onClick = ({ key }) => {
  // message.info(`Click on item ${key}`);
  if(key==3){
	  window.location.href="/login"
  }
};
const menu = (
  <Menu onClick={onClick}>
    <Menu.Item key="1">基本资料</Menu.Item>
    <Menu.Item key="2">修改密码</Menu.Item>
    <Menu.Item key="3">退出</Menu.Item>
  </Menu>
);

 function Goods(props) {
	function callback(key) {
	  console.log(key);
	}
  return (
    <div>
	  <Layout>
	      <Header className="header" className={styles.header}>
	        <div className="logo" className={styles.logo}>
				<img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574246656954&di=3a83ee72d53a4de29d5b99d32f11bf75&imgtype=0&src=http%3A%2F%2Fphotocdn.sohu.com%2F20151029%2Fmp38490311_1446085292402_1_th.jpeg" className={styles.img}/>
			</div>
			<Tabs defaultActiveKey="1" onChange={callback}>
			    <TabPane tab={<Icon type="global" className={styles.icon}/>} key="1">
			    </TabPane>
			    <TabPane tab={<Icon type="redo" className={styles.icon}/>} key="2">
			    </TabPane>
			    <TabPane tab={<Search placeholder="input search text" onSearch={value => console.log(value)} enterButton className={styles.search}/>} key="3">
			    </TabPane>
				 <TabPane tab={<Icon type="bell" className={styles.icon}/>} key="4">
				 </TabPane>
				<TabPane tab={<Icon type="setting" className={styles.icon}/>} key="5">  
				</TabPane>
				<TabPane tab={<Icon type="tag" className={styles.icon}/>} key="6">
				</TabPane>
				<TabPane tab={<Icon type="fullscreen" className={styles.icon}/>} key="7">  
				</TabPane>
				<TabPane tab={<Dropdown overlay={menu}>
			    <span className={styles.user}>
			      {props.name}<Icon type="caret-down" />
			    </span>
			</Dropdown>} key="8">
				</TabPane>
				<TabPane tab={<Icon type="more" className={styles.icon}/>} key="9">
				</TabPane>
			  </Tabs>
	      </Header>
	      <Layout>
	        <Sider width={200} style={{ background: '#fff' }}>
	          <Menu
	            mode="inline"
	            defaultSelectedKeys={['1']}
	            defaultOpenKeys={['sub1']}
	            style={{ height: '100%', borderRight: 0 }}
	          >
	            <SubMenu
	              key="sub1"
	              title={
	                <span>
	                  <Icon type="profile" />
	                  商品管理
	                </span>
	              }
	            >
	              <Menu.Item key="1"><Link to="/">商品列表</Link></Menu.Item>
	              <Menu.Item key="3"><Link to="/index/newGoods">新商品</Link></Menu.Item>
	            </SubMenu>
	            <SubMenu
	              key="sub2"
	              title={
	                <span>
	                  <Icon type="dollar" />
	                  交易管理
	                </span>
	              }
	            >
	              <Menu.Item key="5"><Link to="/index/orderList">订单管理</Link></Menu.Item>
				  <Menu.Item key="9"><Link to="/index/wuliu">物流管理</Link></Menu.Item>
	            </SubMenu>
	            <SubMenu
	              key="sub3"
	              title={
	                <span>
	                  <Icon type="pay-circle" />
	                  支付管理
	                </span>
	              }
	            >
	              <Menu.Item key="10"><Link to="/index/zhifu">支付管理</Link></Menu.Item>
	              
	            </SubMenu>
				<SubMenu
				  key="sub4"
				  title={
				    <span>
				      <Icon type="solution" />
				      管理员
				    </span>
				  }
				>
				  <Menu.Item key="12"><Link to="/index/quanxian">权限设置</Link></Menu.Item>
				  <Menu.Item key="14"><Link to="/index/guanliyuan">管理员信息</Link></Menu.Item>
				</SubMenu>
				<SubMenu
				  key="sub5"
				  title={
				    <span>
				      <Icon type="user" />
				      会员管理
				    </span>
				  }
				>
				  <Menu.Item key="15"><Link to="/index/vip">会员列表</Link></Menu.Item>
				</SubMenu>
	          </Menu>
	        </Sider>
	        <Layout style={{ padding: '0 24px 24px' }}>
	          <Breadcrumb style={{ margin: '16px 0' }}>
	            <Breadcrumb.Item>App</Breadcrumb.Item>
	            <Breadcrumb.Item>index</Breadcrumb.Item>
	            <Breadcrumb.Item>goodsList</Breadcrumb.Item>
	          </Breadcrumb>
	          <Content
	            style={{
	              background: '#fff',
	              padding: 24,
	              margin: 0,
	              minHeight: 280,
	            }}
	          >
	            {props.children}
	          </Content>
	        </Layout>
	      </Layout>
	    </Layout>
    </div>
  );
}


export default connect(state=>state.info)(Goods)